package org.se.scut.pinterest.mina.codec.filte.coder.encoder;

import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolEncoderOutput;
import org.apache.mina.filter.codec.demux.MessageEncoder;
import org.se.scut.pinterest.mina.codec.msg.AllPictureTypeMessage;

public class AllPictureTypeMessageEncoder extends BaseMessageEncoder implements MessageEncoder<AllPictureTypeMessage> {
	
	@Override
	public void encode(IoSession session, AllPictureTypeMessage msg,
			ProtocolEncoderOutput out) throws Exception {
		IoBuffer buffer = IoBuffer.allocate(20).setAutoExpand(true);
		buffer.putString(msg.getSymbol() + delimiter, ENCODER);
		buffer.putString(msg.getLastModifiedDate() + delimiter, ENCODER);
		buffer.flip();
		out.write(buffer);
		
	}

}
